package club.janna.trace.service.c.impl;

import club.janna.trace.api.CService;
import club.janna.trace.api.DService;
import club.janna.trace.service.domain.CEntity;
import club.janna.trace.service.c.mapper.CMapper;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Panbo.Guo
 */
@DubboService
public class CServiceImpl implements CService {

    @Autowired
    private CMapper cMapper;
    @DubboReference
    private DService dService;

    @Override
    public String getValue(Long id) {
        CEntity a = cMapper.selectById(id);
        if(a == null)
            throw new RuntimeException("c not found! id -> " + id);
        return dService.getValue(a.getRefId());
    }
}
